#ifndef ABSTRACTPRINCIPAL_H
#define ABSTRACTPRINCIPAL_H

#include <QString>

#include <plugin/plugin_global.h>

namespace antu
{
namespace plugin
{
class PLUGINSHARED_EXPORT AbstractPrincipal
{
public:
    AbstractPrincipal();
    AbstractPrincipal(const QString& credential);
    AbstractPrincipal(const QString& credential, const QString& securityToken);
    ~AbstractPrincipal();

    inline QString credential() const
    {
        return this->m_sCredential;
    }

    inline QString securityToken() const
    {
        return this->m_sSecurityToken;
    }

    inline bool isEmpty() const
    {
        return this->m_sCredential.isNull() || this->m_sCredential.isEmpty();
    }

    virtual bool hasPermission(const QString& domain, const QString& action, const QString& item) const = 0;

private:
    QString m_sCredential;
    QString m_sSecurityToken;
};

class PLUGINSHARED_EXPORT UsernamePasswordPrincipal : public AbstractPrincipal
{
public:
    UsernamePasswordPrincipal();
    UsernamePasswordPrincipal(const QString& credential);
    UsernamePasswordPrincipal(const QString& credential, const QString& password);

    virtual bool hasPermission(const QString& domain, const QString& action, const QString& item);
};
}
}


#endif // ABSTRACTPRINCIPAL_H
